cannot load module 'Change Proposal Links' in batch mode

I have written a script and tested it in DOORS: It has created a new object in the respective "Proposal" module, and it has created a link to the object from the original module.

But when I run the script in batch mode, then comes the error message "cannot load module 'Change Proposal Links'".
The error occurs only if no link ("Change Proposal Links") has been created between the modules.

Please help me.
kstreichan - Tue Jan 19 07:08:50 EST 2010

Re: cannot load module 'Change Proposal Links' in batch mode
llandale - Tue Jan 19 18:08:13 EST 2010

I'm guessing you are opening it visibly
Module mLink = share(NameLinkMod, true)

Well, the 'visible' code isn't loaded in Batch mode. Anyway, routinely open modules invisibly in scripts unless you intend to display it to a human.

  • Louie

Re: cannot load module 'Change Proposal Links' in batch mode
kstreichan - Wed Jan 20 03:50:02 EST 2010

llandale - Tue Jan 19 18:08:13 EST 2010
I'm guessing you are opening it visibly
Module mLink = share(NameLinkMod, true)

Well, the 'visible' code isn't loaded in Batch mode. Anyway, routinely open modules invisibly in scripts unless you intend to display it to a human.

  • Louie

Hello Louie,

no, I edit the module in invisible mode.
See my code:

string modulePath = "/Test Projekt/Diagnose";
int absNumOriginalObj = 1004;

Module helpMod = read(modulePath, false);
Project p = getParentProject(helpMod);
string parentPath = fullName p;
close(helpMod);

Module linkMod = edit(parentPath "/Change Proposal System/Change Proposal Links", false);
Module originalMod = read(modulePath, false);
Module proposalMod;

Object o;
for o in linkMod do {
string sourceName = o."Source";
string targetName = o."Target";

if (targetName == fullName originalMod) {
close(linkMod);
proposalMod = edit(sourceName, false);
break;
};
};

Object o2;
for o2 in proposalMod do { };
Object proposalObj = create(after(Object o2));

proposalObj."CP Attr - Change Type" = "Modification";
proposalObj."Object Text" = "Modification of object DIA1004 in '/Test Projekt/Diagnose";
proposalObj."CP Attr - Proposal" = "true";
proposalObj."CP Attr - Status" = "New";
proposalObj."CP Attr - Priority" = "Medium";
proposalObj."CP Attr - Reason For Change" = "";
proposalObj."Proposed Object Heading" = "Funktion bedienen (changed)";
proposalObj."Using Object Heading" = "true";

Object originalObj = object(absNumOriginalObj, originalMod);

proposalObj -> "Change Proposal Links" -> originalObj;

Thanks for more help.

Re: cannot load module 'Change Proposal Links' in batch mode
llandale - Wed Jan 20 13:18:58 EST 2010

kstreichan - Wed Jan 20 03:50:02 EST 2010
Hello Louie,

no, I edit the module in invisible mode.
See my code:

string modulePath = "/Test Projekt/Diagnose";
int absNumOriginalObj = 1004;

Module helpMod = read(modulePath, false);
Project p = getParentProject(helpMod);
string parentPath = fullName p;
close(helpMod);

Module linkMod = edit(parentPath "/Change Proposal System/Change Proposal Links", false);
Module originalMod = read(modulePath, false);
Module proposalMod;

Object o;
for o in linkMod do {
string sourceName = o."Source";
string targetName = o."Target";

if (targetName == fullName originalMod) {
close(linkMod);
proposalMod = edit(sourceName, false);
break;
};
};

Object o2;
for o2 in proposalMod do { };
Object proposalObj = create(after(Object o2));

proposalObj."CP Attr - Change Type" = "Modification";
proposalObj."Object Text" = "Modification of object DIA1004 in '/Test Projekt/Diagnose";
proposalObj."CP Attr - Proposal" = "true";
proposalObj."CP Attr - Status" = "New";
proposalObj."CP Attr - Priority" = "Medium";
proposalObj."CP Attr - Reason For Change" = "";
proposalObj."Proposed Object Heading" = "Funktion bedienen (changed)";
proposalObj."Using Object Heading" = "true";

Object originalObj = object(absNumOriginalObj, originalMod);

proposalObj -> "Change Proposal Links" -> originalObj;

Thanks for more help.

Let me guess. Interactively, you run the script from your CPS folder. Well, interactively, unless you change the current folder, the batch script runs from the root folder.

You need to specify the full path to the link module, when creating the link.

  • Louie

You don't need to open the link module edit; read will do.
Set Using Object Text true
Trap open and link errors.
Check for null returns